package br.com.gc.wrappers;

public class ConcatenandoStrings {
	
	public static void testeStringbuffer(){

		//StringBuffer sb = new StringBuffer();
		StringBuilder sb = new StringBuilder();
		long begin = System.currentTimeMillis(); //retorna um long com a hora em milisegundos
		
		for (int i=0 ; i<100000 ; i++){
			sb.append(i);
		}
		
		long end = System.currentTimeMillis();
		System.out.println("Buffer append.."+(end - begin)+" ms");
		
	}

	public static void testeString(){
		
		String x = "";
		long begin = System.currentTimeMillis(); //retorna um long com a hora em milisegundos
		
		for (int i=0 ; i<100000 ; i++){
			x +=1;
		}
		
		long end = System.currentTimeMillis();
		System.out.println((end - begin)+" ms");
	}
	
	public static void main (String[] args){
		testeStringbuffer();
		testeString();
	}

}
